
var express = require('express'),
    http    = require('http'),
    path    = require('path'),
    config  = require('./config'),
    routers = require('./app/router'),
    app = express();

app.set('port', process.env.PORT || config.port);
app.set('views', __dirname + '/');
app.set('view engine', 'jade');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
//app.use(express.cookieParser(config.cookieSecret));
//app.use(express.session({ secret: config.cookieSecret }));
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'extjs')));

routers.init(app);

http.createServer(app).listen(app.get('port'), function(){
    console.log("Listening on port %d, %s", app.get('port'), app.settings.env);
});
